package error;

import gui.HouseEditor;

import java.awt.Color;

public class GUIError {

	public static boolean addRoomError() {
		if (HouseEditor.getInstance().getTypeIndex() < 0) {
			HouseEditor.getInstance().setRoomErrorText(
					"Please select a room type.", Color.red);
			return true;
		}
		try {
			Integer.parseInt(HouseEditor.getInstance().getRoomLengthString());
		} catch (Exception e) {
			HouseEditor.getInstance().setRoomErrorText("Invalid Length.",
					Color.red);
			return true;
		}
		try {
			Integer.parseInt(HouseEditor.getInstance().getRoomWidthString());
		} catch (Exception e) {
			HouseEditor.getInstance().setRoomErrorText("Invalid Width.",
					Color.red);
			return true;
		}
		try {
			Integer.parseInt(HouseEditor.getInstance().getRoomHeightString());
		} catch (Exception e) {
			HouseEditor.getInstance().setRoomErrorText("Invalid Height.",
					Color.red);
			return true;
		}
		return false;
	}

}
